﻿<!doctype html>
 <html >
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="/css/common.css">
   <link rel="stylesheet" href="/css/main.css">
   <script type="text/javascript" src="/js/jquery.min.js"></script>
   <script type="text/javascript" src="/js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="/js/common.js"></script>
</head>

<body>
<div id="forms" class="mt10">
        <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">收入证明流程</b></div>
            <div class="box_center">
              <form id="form" class="jqtransform">
               <table class="form_table pt15 pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                  <td class="td_right">姓名：</td>
                  <td class="">
                      <input name="realName" value="${user.realName}" style="width: 40px; background-color: #EEEEEE;" readonly>
                  </td>
				  </tr>
				  <tr>
                  <td class="td_right">申请时间：</td>
				  <td><input type="date" name="applyTime" class="input-text lh30" size="40"></td>
                </tr>
				<tr>
                  <td class="td_right">部门：</td>
                  <td class="">
                      <select id="pp1" name="deptId" style="width: 66px; background-color: #EEEEEE;" disabled="disabled">
                          <#list list as d>
                              <option <#if d.deptId == user.deptId>
                                  selected
                              </#if> value="${d.deptId}">${d.deptName}</option>
                          </#list>
                      </select>
                  </td>
				  </tr>
				  <tr>
                  <td class="td_right">职务：</td>
                  <td class="">
                      <select id="pp2" name="classsifyName" style="width: 76px; background-color: #EEEEEE;" disabled="disabled">
                          <#list list1 as classs>
                              <option <#if classs.classsifyId == user.classsifyId>selected</#if> value="${classs.classsifyId}">${classs.classsifyName}</option>
                          </#list>
                      </select>
                  </td>
				  </tr>
				
				<tr>
                  <td class="td_right">申请事由：</td>
				  <td>
                      <textarea onchange="gai()" id="yuy" name="applyCause" class="input-text lh30"></textarea>
                  </td>
                </tr>
				
				<tr>
                  <td class="td_right">下一步审批人：</td>
				  <td>
                      <select id="userId" name="userId" class="input-text lh30">
                          <option value="-1">---请选择---</option>
                          <#list userList as ulist>
                              <option value="${ulist.userId}">${ulist.realName}</option>
                          </#list>
                      </select>
                  </td>
                </tr>
                 <tr>
                   <td class="td_right">&nbsp;</td>
                   <td class="">
                       <input type="button" id="trueBtn" class="btn btn82 btn_save2" value="确定">
                       <input type="button" class="btn btn82 btn_res" onclick="location.href='javascript:history.go(-1)'" value="返回">
                   </td>
                 </tr>
               </table>
               </form>
            </div>
          </div>
        </div>
     </div>
<script>

    //输入框必须输汉字
    function gai(){
        if(!/^[\u4e00-\u9fa5]+$/gi.test(document.getElementById("yuy").value)){
            alert("您必须输入汉字")
            return;
        }
    }

    $("#trueBtn").click(function () {
        var shen = $("#yuy").val();
        if (shen == null || shen.length <0 || shen == ''){
            alert("申请事由不能为空哦")
            return;
        }
        if(!/^[\u4e00-\u9fa5]+$/gi.test(document.getElementById("yuy").value)){
            alert("申请事由必须为汉字，快改正吧")
            return;
        }
        var pl = $("#userId").val();
        if (parseInt(pl) <= 0){
            alert("请选择审核人");
            return;
        }
        $("#pp1").removeAttr("disabled");
        $("#pp2").removeAttr("disabled");
        $.post(
            "/resource/add-income"
            ,$("#form").serialize()
            ,function (result) {
                if (result.code == 0){
                    alert("申请收入证明流程已送达，待审核,请耐性等待")
                    location.href = "/resource/renshi/demo3/list";
                } else {
                    alert(result.msg);
                }
            }
            ,"json"
        );
    });
</script>
</body>
</html>